/*
** my_realloc.c for  in /home/vanet_c//get_next_line
** 
** Made by charles-edouard vanet
** Login   <vanet_c@epitech.net>
** 
** Started on  Fri Nov 30 16:49:01 2012 charles-edouard vanet
** Last update Thu Dec  6 19:40:31 2012 charles-edouard vanet
*/

#include	<stdlib.h>

char	*my_realloc(char *oldptr, const int new_size)
{
  char	*newptr;
  int	i;

  i = 0;
  if ((newptr = malloc(sizeof(char) * new_size + 1)) == NULL)
    return (NULL);
  if (oldptr != NULL)
    {
      while (oldptr[i] != '\0')
	{
	  newptr[i] = oldptr[i];
	  i++;
	}
      free(oldptr);
    }
  newptr[i] = '\0';
  return (newptr);
}
